#include<stdio.h>
#include<string.h>
int atoi(const char*s)
{
    int result=0;
    int sign=1;
    if(s[0]=='-')
    {
        sign=-1;
    }
    while(*s!='\0')
    {
        if(*s<='9'&&*s>='0')
        {
            result=result*10+*s-'0';
        }
        s++;
    }
    result*=sign;
    return result;    
}

int main()
{
    char s[]="-1123";
    printf("%d\n",atoi(s));
}